<!DOCTYPE html>
<html>
<head>
<title>云客客户关系管理系统</title>
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="/static/css/x-admin.css" media="all">

</head>
 
<body>
	<div class="x-nav">
		<span class="layui-breadcrumb"> <a><cite>首页</cite></a> <a><cite>合同管理</cite></a>
			<a><cite>合同列表</cite></a>
		</span> <a class="layui-btn layui-btn-small"
			style="line-height: 1.6em; margin-top: 3px; float: right"
			href="javascript:location.replace(location.href);" title="刷新"><i
			class="layui-icon" style="line-height: 30px">ဂ</i></a>
	</div>
	<div class="x-body">
		<form class="layui-form x-center" method="post" action=""
			style="width: 1200px">
			<div class="layui-form-pane" style="margin-top: 15px;">
				<div class="layui-form-item">
					<label class="layui-form-label">日期范围</label>
					<div class="layui-input-inline">
						<input class="layui-input" placeholder="开始日" id="LAY_demorange_s">
					</div>
					<div class="layui-input-inline">
						<input class="layui-input" placeholder="截止日" id="LAY_demorange_e">
					</div>
					<label class="layui-form-label">查询条件</label>
					<div class="layui-input-inline">
						<select class="layui-input" name="interest" lay-filter="aihao"
							style="display: block; width: 110px; height: 39px; margin-left: 15px">
							<option value="0">全部</option>
							<option value="1">合同编号</option>
							<option value="2">合同名称</option>
							<option value="3">合同总金额</option>
							<option value="4">乙方签约人</option>
							<option value="2">甲方签约人</option>
							<option value="3">合同性质</option>
						</select>
					</div>
					<div class="layui-input-inline">
						<input type="text" name="condition" placeholder="请输入查询条件"
							class="layui-input" style="margin-left: -60px">
					</div>
					<div class="layui-input-inline" style="width: 80px">
						<button class="layui-btn" lay-submit="" lay-filter="sreach"
							style="margin-left: -120px">
							<i class="layui-icon">&#xe615;</i>
						</button>
					</div>
				</div>
			</div>
		</form>
		<xblock> 
		<!-- <a href="/pact/add" class="layui-btn" style="color:white"><button class="btn btn-info" > 
	    <i class="layui-icon">&#xe608;</i>添加合同</button></a>-->
		<button class="layui-btn"
			onclick="pact_add('添加合同','/pact/add','600','750')">
			<i class="layui-icon">&#xe608;</i> 添加合同
		</button>
		<div class="layui-inline">
			<div class="layui-form-item">
				<div class="layui-input-block">
					<select class="layui-input" name="interest" lay-filter="aihao"
						style="width: 110px; height: 39px; margin-top: 13px; margin-left: -100px; background-color: #199F93; color: white">
						<option value="0">更多操作</option>
						<option value="1">EXECL</option>
						<option value="2">批量删除</option>
						<option value="3">批量发短信</option>
						<option value="4">批量发邮件</option>
					</select>
				</div>
			</div>
		</div>
		<span class="x-right" style="line-height: 40px">共有数据：88 条</span></xblock>
		<table class="layui-table" id="app">
			<thead>
				<tr>
					<th><input type="checkbox" name="" value=""></th>
					<th>合同编号</th>
					<th>合同名称</th>
					<th>合同性质</th>
					<th>合同类型</th>
					<th>机构名称</th>
					<th>产品类别名称</th>
					<th>合同经办人</th>
					<th>合同联系人</th>
					<th>合同总金额</th>
					<th>付款方式</th>
					<th>签约日期</th>
					<th>合同开始时间</th>
					<th>合同结束时间</th>
					<th>乙方签约人</th>
					<th>甲方签约人</th>
					<th>审核状态</th>
					<th>备注</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<#list pacts as pact>
				<tr class="gradeX" v-for="pact in result">
					<td><input type="checkbox" value="" name=""></td>
					<td>${pact.id }</td>
					<td>${pact.name }</td>
					<td>${pact.property }</td>
					<td>${pact.kind }</td>					
					<td>${pact.orgName}</td><!--机构名称  -->														
					<td>${pact.proKindName }</td><!--产品类别名称  -->										
					<td>${pact.operatorName }</td><!--合同经办人  -->					
					<td>${pact.contactName }</td><!-- 合同联系人 -->					
					<td>${pact.totalAmount }</td>
					<td>${pact.payWay }</td>
					<td>${pact.date?string('yyyy-MM-dd HH:mm:ss')}</td>
					<td>${pact.beginDate?string('yyyy-MM-dd HH:mm:ss')}</td>
					<td>${pact.endDate?string('yyyy-MM-dd HH:mm:ss')}</td>
					<td>${pact.signB }</td><!--乙方签约人  -->					
					<td>${pact.signA }</td><!-- 甲方签约人 -->					
					<td>${pact.checkState }</td>
					<td>${pact.remark }</td>
					<td class="td-manage">
					    <a href="javascript:;" title="编辑"
						onclick="pact_edit(${pact.id})" class="ml-5"
						style="text-decoration: none"> <i class="layui-icon">&#xe642;</i></a>
						<a href="javascript:;" title="删除"
						onclick="pact_del(this,${pact.id})"
						style="text-decoration: none"> <i class="layui-icon">&#xe640;</i></a>
						<a style="text-decoration: none" title="用户详情"
						onclick="pact_show('用户详情','/pact/showPact?id=${pact.id}','${pact.id}','1000','600')"> 
						<i class="layui-icon">&#xe601;</i></a></td>														
				</tr>								
				</#list>
			</tbody>
		</table>
	<div class="layui-input-inline"><div id="page"></div></div>
		<div class="layui-input-inline" >
			显示条数：<select id="pageSizeSelect"  style="width:70px">
				<option>5</option>
				<option>10</option>
				<option>15</option>
				<option>20</option>
			</select>
		</div>
	</div>
	</div>
</body>
<script src="/static/lib/layui/layui.js" charset="utf-8"></script>
<script src="/static/js/x-layui.js" charset="utf-8"></script>
<!-- <script src="/static/js/vue/vue.min.js" charset="UTF-8"></script> -->
<script src="/static/js/jquery.min.js" charset="UTF-8"></script>
<script src="/static/laypage/laypage.js" charset="UTF-8"></script>
<script>
	layui.use([ 'laydate', 'element', 'laypage', 'layer' ], function() {
		$ = layui.jquery;//jquery
		laydate = layui.laydate;//日期插件
		lement = layui.element();//面包导航
		laypage = layui.laypage;//分页
		layer = layui.layer;//弹出层

		//以上模块根据需要引入

		laypage({
			cont : 'page',
			pages : 100,
			first : 1,
			last : 100,
			prev : '<em><</em>',
			next : '<em>></em>'
		});

		var start = {
			min : laydate.now(),
			max : '2099-06-16 23:59:59',
			istoday : false,
			choose : function(datas) {
				end.min = datas; //开始日选好后，重置结束日的最小日期
				end.start = datas //将结束日的初始值设定为开始日
			}
		};

		var end = {
			min : laydate.now(),
			max : '2099-06-16 23:59:59',
			istoday : false,
			choose : function(datas) {
				start.max = datas; //结束日选好后，重置开始日的最大日期
			}
		};

		document.getElementById('LAY_demorange_s').onclick = function() {
			start.elem = this;
			laydate(start);
		}
		document.getElementById('LAY_demorange_e').onclick = function() {
			end.elem = this
			laydate(end);
		}

	});
	 $(function () {
	   /* var app=new Vue({
	       el:"#app",
	       data:{
	           result:[]
	       }
	   })  */
	   var getAllUser=function (curr) {
	       $.ajax({
	           type : "POST",
	           dataType : "json",
	           url : "/pact/pactList",
	           data : {
	               currPage:curr || 1,
	               pageSize:10
	           },
	           success : function(msg) {
	               app.result=msg.data;
	               alert(app.result);
	               laypage({
	                   cont : 'pagenav',
	                   pages : msg.data.totalPage,
	                   first : true,
	                   last : true,
	                   currPage : curr || 1,
	                   jump : function(obj, first) {
	                       if (!first) {
	                           getAllUser(obj.curr);
	                       }
	                   }
	               });
	           }
	       });
	   }
	   getAllUser();
	})  

	//批量删除提交
	function delAll() {
		layer.confirm('确认要删除吗？', function(index) {
			//捉到所有被选中的，发异步进行删除
			layer.msg('删除成功', {
				icon : 1
			});
		});
	}
	/*合同-添加*/
	function pact_add(title, url, w, h) {
		x_admin_show(title, url, w, h);
	}
	/*合同-查看*/
	function pact_show(title, url, id, w, h) {
		x_admin_show(title, url, w, h);
	}
	//合同-编辑
	function pact_edit(id) {
			 layer.open({
					type : 2,
					title : "编辑合同",
					fix : false,
					maxmin : true,
					shadeClose : true,
					area : [ "800px", "800px" ],
					content : "updatePact?pactId="+ 10,
					end : function() {
						searchBtn();
						alert(123456789);
					}
				});		
		 }	 
	

	/*合同-删除*/
	function pact_del(obj,id) {  
		  layer.confirm('确认要删除吗？', function(index) {
				$.ajax({
					data : "pactId="+id,
					url : "delePact",
					type : "post",
					success : function() {
						$(obj).parents("tr").remove();
						layer.msg('已删除!', {
							icon : 1,
							time : 1000,
						});
					}
				});
			});		
	}

	//批量删除提交
	 function delAll() {
		layer.confirm('确认要删除吗？', function(index) {
			//捉到所有被选中的，发异步进行删除
			layer.msg('删除成功', {
				icon : 1
			});
		});
	} 
</script>
<script>
	 var _hmt = _hmt || [];
	(function() {
		var hm = document.createElement("script");
		hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
		var s = document.getElementsByTagName("script")[0];
		s.parentNode.insertBefore(hm, s);
	}); 
</script>
</html>
